from django.template import Library
from django.urls import reverse
from web import models

register = Library()


@register.simple_tag
def string_just(num):
    if num < 100:
        # rjust(3,'0') 就是判断是否是三位字符，不是就在前面补0，例如str(sum)=2,得到结果就是002，20就得到020
        num = str(num).rjust(3, "0")
        num = f"#{num}"
    return num
